package 单例模式;

/**
 * @author zzs
 * @ClassName Demo.java
 * @Description 使用单例的好处，拥有静态一样的特性又可以使用实例的特性
 * @createTime 2022年05月14日 20:11:00
 */
public class Demo {
    public static void main(String[] args) {
        Single single = Single.getSingle();
        Single single2 = Single.getSingle();
        single.a = 10;
        System.out.println(single.a);
        System.out.println(single2.a);

        System.out.println(Single.getSingle() == Single.getSingle());
        System.out.println(Single2.getSingle() == Single2.getSingle());
        System.out.println(Single3.getSingle() == Single3.getSingle());
    }
}
